<?php
/**
* 登录页面
* $Id: login.php 141 2010-05-02 01:46:57Z bwanglei $
*/

include_once(dirname(__FILE__).'/init.php');

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
	$username_login = $_POST['username_login'];
	$password_login = $_POST['password_login'];
	$user_data = apf_login($username_login, $password_login, $mysql_conn);
	if (isset($_GET['source'])) {
		apf_redirect(0, $_GET['source']);
	} else {
		apf_redirect(0, $apf_settings['base_url'].'/index.php');
	}
}

// 如果已经登录 转向页面
if (apf_is_login($mysql_conn)) {
	if (isset($_GET['source'])) {
		apf_redirect(0, $_GET['source']);
	} else {
		apf_redirect(0, $apf_settings['base_url'].'/index.php');
	}
	die();
}

include_once(BASE_PATH.TEMP_DIR.'/login.php');
?>
